<html>
<head>
<title>hextoy.php</title>
</head>
<body>
Warning: this script just unpacks what you give it.
<form method=post>
Value: <input type="text" name="value">

<input type="submit" name="do" value="Hex">
<input type="submit" name="do" value="UnHex">
<input type="submit" name="do" value="UnHex asctime">
<pre>
<?
/****************************
Kyle Kienapfel

Quick and dirty hex toy, the hex converters i find on the internet dont like
AAAB124124ABCDEF or CA FE BA BE format.

Cribbed a bit from lantools.php, similar idea.
****************************/

if ($_REQUEST['do'] == "UnHex") {
$value = $_REQUEST['value'];
$value = str_replace(' ','',$value);

print "Hex input: $value\n";
print @pack("H*",$value);

}
elseif ($_REQUEST['do'] == "UnHex asctime") {
$value = $_REQUEST['value'];
$value = str_replace(' ','',$value);
echo "Input: $value\n";
list(,$value) = unpack("V",pack("H*",$value));
print date("r",$value);
}
elseif ($_REQUEST['do'] == "Hex") {
$value = $_REQUEST['value'];
//un html escape?
echo "Input: $value\n";
echo chunk_split(implode(" ",unpack("H*",$value)),2," ") . "\n";

}
?>
</pre>
</body></html>
